<template>
  <div class="wrapper">
    <swiper :options="swiperOption" ref="mySwiper" >
      <!-- slides -->
      <swiper-slide class="box" v-for="item in imgUrl" :key="item.id"><img :src="item.url" alt=""></swiper-slide>

      <!-- Optional controls -->
      <div class="swiper-pagination"  slot="pagination"></div>

    </swiper>
  </div>
</template>

<script>
  import 'swiper/dist/css/swiper.css'//引入样式
  import { swiper, swiperSlide } from 'vue-awesome-swiper'//使用组件
  export default {
    name: "Swiper",
    props:{
      imgUrl:Array
    },
    components:{//注册组件
      swiper,
      swiperSlide
    },
    data(){
      return{
        swiperOption:{
          pagination:".swiper-pagination",
          loop:true,
          autoplay:2000
        }
      }
    }
  }
</script>

<style scoped lang="stylus">

  .wrapper  >>>.swiper-pagination-bullet-active{
    background :white;
    touch-action:none;
  }
  .wrapper{
    width:100%;
    overflow:hidden;
    height:0;
    padding-bottom :28.6666%;
    .box{
      img{
        width:100%;
      }
    }
  }
</style>
